<!DOCTYPE html>
	<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1.0">
		<title>Document</title>
		<link rel="stylesheet" type="text/css" href="../layui/css/layui.css">
		<link rel="stylesheet" type="text/css" href="../css/i-travel.css">
	</head>
			<style type="text/css">
			#paymentpaw{
			width: 100%;
			position:fixed;
			width: 100%;
			height: 100%;
			display: none;
			z-index: 9999;
			background: rgba(0,0,0,0.5);
		}
		.enter{
			width: 100%;
			background:#FFFFFF;
			z-index: 102;
			position: fixed;
			bottom:0;
			z-index: 102;
			height: 50%;

		}
		.enter-close{
			width: 100%;
			padding: 1% 0;
		}
		.enter-close i{
			width: 1.5em;
			height: 1.5em;
			display: block;
			float: right;
			margin-right: 3%;
			margin-top: 3%;
			font-style: normal;
		}
		.enter-text{
			width: 100%;
			text-align: center;
			color: #8D8D8D;
			border-bottom:2px solid #F5F5F5 ;
			padding: 2% 0;
			margin-bottom: 4%;
		}
		.enter-input{
			text-align: center;

		}
		.enter-input input{
			width: 90%;
			border: 1px solid #CCCCCC;
			padding: 2% 0;
			text-align: center;
			font-size: 16px;
			display: inline-block;

		}
		.queding{
			padding: 3%;
		}
		.queding span{
			width: 100%;
			display: block;
			background: #57d5f3;
			border-radius: 15px;
			color: #fff;
			padding: 5px 0;
			text-align: center;
		}
		</style>
	<body>
	<form action="">
		<div class="select">
			<div>
				<div class="center select-t">
					<p>发布旅游</p>
					<img src="../img/cancel.png" class="close">
				</div>
				<div class="select-b">
					<p>提示：发布约会即扣除<span>10</span>美金</p>
					<div class="chengyijing">诚意金<span>0</span>美金</div>
					<div class="flex top-up-box">
						<p>支付金额：<span>￥510</span></p>
						<div class="top-up"><a href="recharge_usd.html">去充值</a></div>
					</div>
					<div class="sure center"><input type="button" id="submit" name="" value="确定发布"></div>
				</div>
			</div>
		</div>
		<div id="paymentpaw">

			<div class="enter">
				<div class="enter-close clearfix">
					<i>x</i>
				</div>
				<div class="enter-text">请输入支付密码</div>
				<div class="enter-input">
					<input type="password" name="pay" placeholder="输入支付密码">
				</div>

				<div class="queding"><span>确定发布</span></div>
			</div>
		</div>
		<header>
			<a href="javascript:history.back(-1)" class="back"><img src="../img/back.png" height="18px"></a>
			<div class="center title">发布旅游</div>
		</header>
		<main>
			<div class="flex">
				<p>性别要求：</p>
			    <div class="female">
				    <input type="radio" id="female" value="女" name="tSex" />
				    <label for="female">女</label>
				</div>
				<div class="male">
				    <input type="radio" id="male" value="男" name="tSex" />
				    <label for="male">男</label>
				</div>
			</div>
			<div class="flex place">
				<p>旅游地点：</p>
				<input type="text" name="tFaddress">
				<img src="../img/site.png">
				<input type="text" name="tTaddress">
			</div>
			<div class="flex">
				<p>赴约时间：</p>
				<input type="text" name="tSdate">
			</div>
			<div class="flex">
				<p>出游留言：</p>
				<textarea name="tCount"></textarea>
			</div>
		</main>
		<div class="money">
			<div class="flex">
				<!-- <div class="flex need">
					<p>需要人数:</p>
					<input type="text" name="tNum">
				</div> -->
				<div class="flex need">
					<p>悬赏金:</p>
					<input type="text" name="tMeijin">
				</div>
			</div>
			<div class="flex pay">
				<p>支付方式：</p>
				<div class="pay-r">
					<span><input type="radio" class="pingtai" value="平台担保" name="tPingtai" checked>平台担保</span>
					<span><input type="radio" value="线下支付" name="tPingtai">线下支付</span>
				</div>
			</div>
		</div>
		<div class="fabu center">发布旅游</div>
	</form>
		<script src="../js/jquery-3.3.1.js"></script>
		<script src="../layui/layui.js"></script>
        <script src="../layui/layui.all.js"></script>
		<script src="../js/i-travel.js"></script>
	</body>
</html>
<script>
	$('.fabu').click(function(){
		$('.select').show()
	})
	$('.close,.sure').click(function(){
		$('.select').hide();
	});
	
	$('.enter-close').click(function(){

		$('#paymentpaw').hide();
	});
	$('#submit').click(function () {
		$('#paymentpaw').show();
		
	});

		$.get('/meiyou/getChenYiJin',function(data){
			console.log(data.chenyijin);
			$('.chengyijing').show();
			$('.chengyijing span').text(data.chenyijin);	
		});
		$(document).on('click','.pingtai',function(){
			$.get('/meiyou/getChenYiJin',function(data){
			console.log(data.chenyijin);
			$('.chengyijing').show();
			$('.chengyijing span').text(data.chenyijin);	
		});
	});
		$(document).on('click','.xianxia',function(){
			$('.chengyijing').hide();
			$('.chengyijing span').text(0);
	});


	$('.fabu').click(function(){
		var chengyijing=parseInt($('.chengyijing span').text());
		var fbprice=parseInt($('.select-b>p span').text());
        // var xsprice=parseInt($('input[name="tMeijin"]').val());
        var price=fbprice+chengyijing;
        $('.top-up-box>p span').text('￥'+price);
	});
	
	$.get('/meiyou/getFaBujin',function(data){

			console.log(data.num);
			$('.select-b>p span').text(data.num);
			

	});
	
		$('.queding').click(function(){
			var formData= new FormData();
			var chengyijing=parseInt($('.chengyijing span').text());
			var fbprice=parseInt($('.select-b>p span').text());
        	// var xsprice=parseInt($('input[name="tMeijin"]').val());
			var tSex=$('input[name="tSex"]:checked').val();
			var tFaddress=$('input[name="tFaddress"]').val();
			var tTaddress=$('input[name="tTaddress"]').val();
			var tSdate=$('input[name="tSdate"]').val();
			var tCount=$('textarea[name="tCount"]').val();
/*<<<<<<< HEAD*/
			var tMeijin=fbprice+chengyijing;
			var tPingtai=$('input[name="pay"]:checked').val();
/*=======*/
			// var tMeijin=fbprice+xsprice;
			var tPingtai=$('input[name="tPingtai"]:checked').val();
/*>>>>>>> branch 'master' of https://gitee.com/xiejun123/Meiyou.git*/
			var pay=$('input[name="tCount"]').val();
			
			formData.append('tSex',tSex);
			formData.append('tFaddress',tFaddress);
			formData.append('tTaddress',tTaddress);
			formData.append('tSdate',tSdate);
			formData.append('tCount',tCount);
			formData.append('tMeijin',tMeijin);
			formData.append('tPingtai',tPingtai);
			formData.append('pay',pay);
		$.ajax({
			url: "/meiyou/insTour",
			data:formData,
			type: "Post",
            cache: false,//上传文件无需缓存
            processData: false,//用于对data参数进行序列化处理 这里必须false
            contentType: false, //必须
            success: function (data) {
            	if(data.code==100){
					layer.msg(data.msg,{icon:6,time:1000},function(){
	        		window.location.reload();
	        	})
            	}else{
					layer.msg(data.msg,{icon:5,time:1000})
            	}
            	
            	console.log(data)
            }
        })
	});

</script>
